package com.ihm.labyrinth.bodies;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.Log;

public class Boulet extends LabObject {

	private static final int POWERCOUNTER = 50;
	
	private int powerCounter;
	
	public Boulet(RectF boundingBox) {
		super(boundingBox);
		mouving = true;
		this.setColor(Color.GREEN);
		source = new Rect(192, 192, 256, 256);
		powerCounter = 0;
		coefPoids = 1.2f;
	}
	
	public int getPowerCounter() {
		return powerCounter;
	}

	public void setPowerCounter(int powerCounter) {
		this.powerCounter = powerCounter;
	}
	
	
	@Override
	public void setVitesseY(float yGravity, boolean collision, boolean noCoef){
		
		if(powerCounter < POWERCOUNTER){
			if(collision){
				powerCounter = POWERCOUNTER;
				super.setVitesseY(yGravity, collision, noCoef);
			}
			powerCounter++;
		}
		else{
			super.setVitesseY(yGravity, collision, noCoef);
		}
		
	}
	
	@Override
	public void setVitesseX(float xGravity, boolean collision, boolean noCoef){
		
		if(powerCounter < POWERCOUNTER){
			if(collision){
				powerCounter = POWERCOUNTER;
				super.setVitesseY(xGravity, collision, noCoef);
			}
			powerCounter++;;
		}
		else{
			super.setVitesseX(xGravity, collision, noCoef);
		}
	}

}
